﻿using ahdelivery.pdd.vo;
using ahdelivery.pdd.ws;
using Center.lib.utils.json;
using Center.lib.utils.log;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ahdelivery.center
{
    public partial class FrmPddEncry : Form
    {
        public WsUtils ws { get; set; }
        public FrmPddEncry()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            ws = new WsUtils();
            ws.connect(this.txtIp.Text, 5000);
            String getPrinterListCmd = "{\"requestID\":\"12345678901234567890\",\"verson\":\"1.0\",\"cmd\":\"getPrinters\"}";
            ws.sendData(getPrinterListCmd);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            PddPrinterVo vo = new PddPrinterVo();
            TaskBean task = new TaskBean();
            List<DocumentBean> list = new List<DocumentBean>();
            DocumentBean documentsBean = new DocumentBean();
            List<ContentsBean> contentsBeans = new List<ContentsBean>();
            ContentsBean contentsBean = new ContentsBean();
            contentsBean.encryptedData="c30e5fed4b713284d754a2bd00c7184e589fd4e54e6438e7572086b963c3eddb95efa1822a104981654f208506c80c94c8e75e03c4d9342cfc0c0abf0aa718e4e525b85dd9b36e5ef7db693aecfbf23138ab8f1b15027ff9fb2111ec91885e2580c7733ca0d4b4a6f75f9be63fec68b3a5c1a488623905131f02ab94eee95fcb7037609b46e7645bf54c6e6ab1fa5fca42630b4ba444eb25558626ce4bcd55924152381b0c99866ab3d0652ef8493ea42afdf562807bb02df0166fb12ef37734a994eca4cf5492b9e1fa11011218db069dfeff1c91c55512fff2e044ff03359019bfba886e36bdb032ec8ea2bc730328639cc1be5f547cf4de7cfced92b328fccbde8767da44213098ec2c7545e74a118e9d17d5b66005a2ac5d39d39b3b4a9e4ba1b2799a22a05724b3f0279f80e8fae8fe03de6e96cd39280dcd004edba063333e95f903922993009cd7d58c07a521024fd060c200f965914572fe22e925080cef93f68205f283af3afed84152e3707b8775699b168b1dc3912632833c87e028048b3621bd3a1f508618dcfbde724101067bf482b8608e4529df3cede52ce0ed5fca4164cebacc808daf3a1c002dab9db01c8ff28a91dd3a5dea087910ee7e049ca0ff156467b0805942b3e3a0645fc385caa96de32c308133f8f72b6abcc5cd4defb2ed8a12a719c0c6279bf401c878cf809d66f1cf44775f2ad655de96456b8fccf9b62115b1ac67a678c28f9ff60f90654a3350ff70eb4f44bb95ca1b1ebe3691f7b80e3cd7c373f561f69275bb952630c01562afd172273ed4f2f62b719c99f8604be95c6113c6605bf5ae6e470d8f93975ef9cfb8fc4dd3c2c65174597a48c5f46b5e4e9168ff845ccf671edec1f56cc732f0d53a190fe17ff935590e8c6bfb9ccce0fcdd55fdff045afff7cdc7abfc58f242ac879c01575c090285aca9c77df084b962acbf1f35f0001ec268e93d3d34558da0cea036e6a0726f5e12d80366adbe71c303c52dc213e335156089666b33045091f9e0f4aa7acb4d5e5604518f31ab3bd6a82db60d0ecd2b67f95112e31f90ff6d45a5fb6c306e93b1c977a2c611188db396d50b40f7444efd747550e5923b10faf0ad4643475f0b9257";
            contentsBean.signature="JXvLNiJKFOgirkEGIw/rOmWFSFMtTrA7iLZhQ72VSZZwagS7F3puGR/ZcyCADhG12UA0hMRCxdwOTQ3iIU9Yun2LCaL0DkBLERE+MZ/caT7SckcRVPil4wUz+uWgvaWnFR/CyjDPEVDvOtOBS5RCAvdu6E1oCCa0qWMa/hP/gRw=";
            contentsBean.templateURL="https://file-link.pinduoduo.com/yzxb_one";
            contentsBean.ver="3";
            contentsBeans.Add(contentsBean);
            documentsBean.contents=contentsBeans;
            list.Add(documentsBean);
            task.documents=list;
            vo.task= task;

            String printData = JsonHelper.ToJson(vo);
            LogHelper.WriteLog(printData);
            ws.sendData(printData);
        }
    }
}
